package com.seed.checker;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

/**
 * @author qingqing.liang
 * @create 2017-11-30
 **/
@Slf4j
public class Client {
    private static final String NAME = "NAME";
    private static final String HEALTH = "HEALTH";


    /**
     * 1.检查用户的姓名是否合法，user
     * 2.检查身体是否健康 user.body
     */

    @Test
    public void checkTest(){
        User user = new User();
        Body body = new Body();

        Checker nameChecker = new Checker<User,String>(user, NAME) {
            @Override
            public boolean doCheck() {
                log.info("NAME校验，获取到源数据" + user);
                log.info("NAME校验：通过");
                return true;
            }
        };
        Checker sexChecker = new Checker<Body,String>(body, HEALTH) {
            @Override
            public boolean doCheck() {
                log.info("HEALTH校验，获取到源数据" + body);
                log.info("HEALTH校验：未通过");
                return false;
            }
        };

        //检查链
        nameChecker.setNext(sexChecker);


    //    检查项(源数据及其描述)，检查方法，    检查结果

        Result ret = nameChecker.start();

        log.info("最终结果：" + ret.getPass());

    //    检查项配置


    }

}
